﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace ALEXBlog.IService.Base
{
    public interface IBaseService<TEntity> where TEntity : class, new()
    {
        //增
        Task<int> AddAsync(params TEntity[] models);

        //删
        Task<int> RemoveAsync(params TEntity[] model);
        Task<int> RemoveAsync(object id);
        Task<int> RemoveAsync(params object[] ids);

        //改
        Task<int> UpdateAsync(params TEntity[] models);

        //查
        Task<TEntity> FindAsync(Expression<Func<TEntity, bool>> whereExpression); //单例查询
        Task<List<TEntity>> QueryAsync(); //查询所有
        Task<List<TEntity>> QueryAsync(Expression<Func<TEntity, bool>> whereExpression); //条件查询
        Task<List<TEntity>> QueryAsync(int pageIndex, int pageSize, Expression<Func<TEntity, bool>> whereExpression); //分页条件查询

    }
}
